!***********************************************************
      SUBROUTINE vertex(uu,uj,u,umat)  
      include 'param.dat'
      DIMENSION U(Nf), Umat(Nd,Nd)
      
!------- U-for Ising fileds:
!------- Upper triangle:
!------- H= Sum Umm'Nm,upNm',dn + (Umm'-Jmm')Nm,up*Nm',up

        ij=0
        DO i=1,Nd-1
          DO j=i+1,Nd
            Umat(i,j)=0.0
		  ij=ij+1
            IF (i.le.Nlm.and.j.gt.Nlm) THEN
               jj=j-Nlm
		     IF(JJ.EQ.I) THEN
		 	   U(ij)=UU
		     ELSE
			   U(ij)=UU-UJ
		     ENDIF
            ELSE
	      U(ij)=UU
          ENDIF

	   Umat(i,j)=U(ij)
         ENDDO
        ENDDO

        DO i = 1,Nd
	    Umat(i,i) = 0.0
          DO j = i,Nd
             Umat(j,i) = Umat(i,j)
         ENDDO
        ENDDO

      RETURN
      END
!***********************************************************
!***********************************************************
      SUBROUTINE matsub
      include 'param.dat'
      DIMENSION omega(nom),bk(16,16)
      COMMON/param/DOmega,dtime,omega,temp
      COMMON/bk/bk
      DOmega=temp*pi
      dtime=1.d0/nom/temp*2.d0
!..... QMC Fermionic  Matsubara frequencies:
      DO iom=1,nom
         io=iom-1
         omega(iom)=dOmega*(2*io+1)
      ENDDO
      bk(1,1)=1.d0
      DO i=2,16
        bk(i,1)=1.d0
        bk(i,i)=1.d0
        DO j=2,i-1
          bk(i,j)=bk(i-1,j-1)+bk(i-1,j)
        ENDDO
      ENDDO
      RETURN
      END
!***********************************************************
	SUBROUTINE userinfo(fh_info)

	  INTEGER fh_info
	  INTEGER hostnm,ihost
	  CHARACTER*24 fdate
	  CHARACTER*24 getlog
	  CHARACTER*24 name
	  REAL*4 dtime,tarray(2)
	  REAL*8 exec_time,user_time


!	  ihost = hostnm(name)

	  WRITE(fh_info,*)
	  WRITE(fh_info,*) "USR_INFO: Date : ",fdate()
!	  WRITE(fh_info,*) "          User : ",getlog()
!	  WRITE(fh_info,*) "          Host : ",name


	  exec_time = dtime(tarray)

	  RETURN

	  ENTRY exitinfo(fh_info)

	  exec_time = dtime(tarray)
	  user_time = tarray(1)

	  WRITE(fh_info,*)
	  WRITE(fh_info,*) "USR_INFO: Time of computation"
	  WRITE(fh_info,'(11x,"Total run-time : ",f10.3,1x,"seconds")') 
     &                    exec_time
	  WRITE(fh_info,'(11x,"Total cpu-time : ",f10.3,1x,"seconds")') 
     &                   user_time

	  RETURN
	END 
!***********************************************************
